<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Plateau du Quizz</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	include_once("../metier/question.dao.php");
	include_once("../metier/proposition.dao.php");
	include_once("../metier/reponse.dao.php");
	include_once("../metier/myPDO.class.php");
	$db = new myPDO("127.0.0.1", "root", "", 0);
	$questionDAO = new QuestionDAO();
	$propositionDAO = new PropositionDAO();

	print_r($_POST);
	$listeDeQuestions = $questionDAO->findAllQuestions($db) ;
	//$question = new Question(1, "", null, 0);

	//print_r($listePropositions);
	//print_r($listeDeQuestions);
?>
</head>
<body>
<div>
	<?php foreach($listeDeQuestions as $question) { ?>
	<div>
		<p><?php echo $question->getLibelle(); ?></p>
			<?php $listePropositions = $propositionDAO->getPropositionsByQuestion($question, $db); ?>
		<p>
			<?php
				if($listePropositions != null) {
					foreach($listePropositions as $proposition) {
						$reponseDAO = new ReponseDAO();
						$reponse = new Reponse($proposition->getIdReponse(), "", "");
						$reponse = $reponseDAO->findReponse($reponse, $db);
			?>
			<input type= "radio" name="propositionsQuestion<?php echo $proposition->getIdQuestion(); ?>"
				value="<?php echo $proposition->getIdReponse() ; ?>"><?php echo $reponse->getLibelle() ; ?>
			<?php } } ?>
		</p>
	</div>
	<?php } ?>
</div>
</body>
</html>